package com.tkm.java;

import java.util.HashSet;

public class EventManager {

    @FunctionalInterface
    public interface OnEventListener {
        void onEvent(int event);
    }

    private final HashSet<OnEventListener> listeners = new HashSet<>();

    public void addListener(OnEventListener listener) {
        System.out.printf("Adding listener %s\n", listener);
        listeners.add(listener);
    }

    public void removeListener(OnEventListener listener) {
        System.out.printf("Removing listener %s\n", listener);
        listeners.remove(listener);
    }
}
